//------------------------------------------------------------------------------
// <copyright file="stdafx.H" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently

#pragma once

#ifdef ENABLE_GAMESTEST_RPC

#include "targetver.h"
#include <sal.h>
#include <stdlib.h>

#ifdef _DURANGO
#include <xdk.h>
#include <wrl.h>
#else
#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
#define _WINSOCKAPI_					// stops windows.h including winsock.h
#include <Windows.h>
#endif

#include <ObjBase.h>
#include <memory>
#include <string>
#include <utility>
#include "RpcError.h"
#include "RpcAnnotations.h"
#include "RpcErrorCodes.h"
#include "Json.h"

// This macro should be used around all calls to methods that return an HRESULT.
#define CHK(exp)	{ hr = (exp); if(FAILED(hr)) { Microsoft::Internal::GamesTest::Rpc::Server::RpcPrintError(hr); goto end; } }
#define CHK_REF(exp)	{ HResult hrRef = (exp); if(FAILED(hrRef.Value)) { Microsoft::Internal::GamesTest::Rpc::Server::RpcPrintError(hrRef.Value); hr = hrRef.Value; goto end; } }

#define VERIFY_PARAM_NOT_NULL(param) { if(param == nullptr) { hr = E_INVALIDARG; goto end; } else { hr = S_OK; } }

// Throw an RT ComException for the HRESULT, also declaring HRESULT variable.
#define CHKRT(result) HRESULT hr = (result); if (FAILED(hr)) { throw ref new Platform::COMException(hr); }

// Throw an RT ComException for the HRESULT, assuming it's "After" the HRESULT variable is declared.
#define CHKRTA(result) hr = (result); if (FAILED(hr)) { throw ref new Platform::COMException(hr); }

struct Empty {};

typedef unsigned int RequestIdType;

#endif // ENABLE_GAMESTEST_RPC